import { defineStore } from 'pinia';

interface FlowFile {
  flowInfo: Recordable;
  currentFlowData: Recordable;
  flowEdit: Recordable;
  curLink: Recordable;
}

export const useFlowStore = defineStore({
  id: 'app-flow',
  state: (): FlowFile => ({
    flowInfo: {},
    currentFlowData: {},
    flowEdit: {},
    curLink: {},
  }),
  getters: {
    getFlowInfo(): Recordable {
      return this.flowInfo;
    },
  },
  actions: {
    setFlowInfo(info: Recordable) {
      this.flowInfo = info;
    },
    setCurrentFlowData(info: Recordable) {
      this.currentFlowData = info;
    },
    setFlowEdit(info: Recordable) {
      console.log('setFlowEdit', info);
      this.flowEdit = info;
    },
    setCurLink(info: Recordable) {
      this.curLink = info;
    },
  },
});
